package com.example.demo.vo;

import com.example.demo.dao.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.concurrent.RecursiveTask;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVoIn {
    private String account;
    private String name;
    // 默认密码为空即没有输入
    private String password = "";
    private int age;
    private int sex;
    private String phone;
    private int roleId = 2;
    private String isValid = "Y";

    // 互相转换
    public static UserVoIn exchange(User user){
        UserVoIn userVoIn = new UserVoIn();
        BeanUtils.copyProperties(user,userVoIn);
        return userVoIn;
    }


    public static User exchange(UserVoIn userVoIn){
        User user = new User();
        BeanUtils.copyProperties(userVoIn,user);
        return user;
    }
}
